package com.lrkj.web.phone;

import com.lrkj.common.core.controller.BaseController;
import com.lrkj.common.core.domain.AjaxResult;
import com.lrkj.common.core.page.TableDataInfo;
import com.lrkj.common.utils.poi.ExcelUtil;
import com.lrkj.property.domain.RoomAuth;
import com.lrkj.property.service.IRoomAuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 房屋认证审批Controller
 *
 * @author yajun_ren
 * @date 2022-08-02
 */
@RestController
@RequestMapping("/phone/roomAuth")
@Api(tags = "房屋认证审批")
public class RoomAuthController extends BaseController {
    @Autowired
    private IRoomAuthService roomAuthService;

    /**
     * 查询房屋认证审批列表
     */
    @ApiOperation(value = "查询房屋认证审批列表", notes = "查询房屋认证审批列表")
    @GetMapping("/list")
    public TableDataInfo list(RoomAuth roomAuth) {
        startPage();
        this.changeParameter(roomAuth.getParams());
        List<RoomAuth> list = roomAuthService.selectRoomAuthList(roomAuth);
        return getDataTable(list);
    }

    /**
     * 获取房屋认证审批详细信息
     */
    @ApiOperation(value = "获取房屋认证审批详细信息", notes = "获取房屋认证审批详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return AjaxResult.success(roomAuthService.selectRoomAuthById(id));
    }

    /**
     * 房屋认证审批
     */
    @ApiOperation(value = "房屋认证审批", notes = "房屋认证审批")
    @PostMapping("approve")
    public AjaxResult approve(@RequestBody RoomAuth roomAuth) {
        return toAjax(roomAuthService.updateRoomAuth(roomAuth));
    }

}
